﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace OpenPms.Migrations
{
    /// <inheritdoc />
    public partial class t304 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_archiveGuests",
                table: "archiveGuests");

            migrationBuilder.RenameTable(
                name: "archiveGuests",
                newName: "ArchiveGuests");

            migrationBuilder.RenameIndex(
                name: "IX_archiveGuests_HotelId_IdNo",
                table: "ArchiveGuests",
                newName: "IX_ArchiveGuests_HotelId_IdNo");

            migrationBuilder.AddColumn<bool>(
                name: "IsCheckOut",
                table: "Orders",
                type: "bit",
                nullable: false,
                defaultValue: false)
                .Annotation("SqlServer:IsTemporal", true)
                .Annotation("SqlServer:TemporalHistoryTableName", "OrdersHistory")
                .Annotation("SqlServer:TemporalHistoryTableSchema", null)
                .Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd")
                .Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ArchiveGuests",
                table: "ArchiveGuests",
                columns: new[] { "HotelId", "Id" });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_ArchiveGuests",
                table: "ArchiveGuests");

            migrationBuilder.DropColumn(
                name: "IsCheckOut",
                table: "Orders")
                .Annotation("SqlServer:IsTemporal", true)
                .Annotation("SqlServer:TemporalHistoryTableName", "OrdersHistory")
                .Annotation("SqlServer:TemporalHistoryTableSchema", null)
                .Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd")
                .Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart");

            migrationBuilder.RenameTable(
                name: "ArchiveGuests",
                newName: "archiveGuests");

            migrationBuilder.RenameIndex(
                name: "IX_ArchiveGuests_HotelId_IdNo",
                table: "archiveGuests",
                newName: "IX_archiveGuests_HotelId_IdNo");

            migrationBuilder.AddPrimaryKey(
                name: "PK_archiveGuests",
                table: "archiveGuests",
                columns: new[] { "HotelId", "Id" });
        }
    }
}
